<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>购物车页面</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<style>
	.pic{
		width: 150px;
		height: 70px;
		margin-top: 0px;
		
	}
	.pic2{
		position: relative;
		width: 75px;
		height: 35px;
		left: 150px;
		top: -40px;
		font-size: 1.6em;
		color: #3B4249;
	}
	#td_n td{
		text-align: center;
	}
	.box-footer{
		width:300px;
		height:30px;
		margin-left: 700px; 
	}
	 .box-footer ul>li{
		float: left;
		margin-left: 25px;
	} 
	.form-group{
	margin-left: 100px;
	}
</style>
<script type="text/javascript">
</script>
</head>
<body class="pos-r">
	<div class="page-container">
		<div class="pic"><img src="../images/logo.png"></div>	
		<div class="pic2">购物车</div>	
		<form action="<%=basePath%>shopCar/deleteBath.do" >
			<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
				<input type="hidden" name="uname" value="<%=loginName%>">
				<button type="submit" class="btn btn-danger radius" ><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</button>
				<a class="btn btn-danger radius"  href="<%=basePath%>orders/selectAll.do?uname=<%=loginName %>"><i class="Hui-iconfont">&#9756;</i> 回到首页</a></span> 
			 </div>
		 
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							
							<th width="40"><input name="" type="checkbox" value=""></th>
				    		<th>商品名称</th>
				    		<th>商品图片</th>
				    		<th>商品单价</th>
				    		<th>商品个数</th>
				    		<th>总价</th>
				    		<th>操作</th>
				    		<th>结算</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${list!=null }">
							<c:forEach items="${list}" var="shopCar">
								<tr id="td_n">
									<td><input name="id" type="checkbox" value="${shopCar.id }"></td>
									<td>${shopCar.sname }</td>
									<td><img alt="图片不存在" src="${shopCar.spicture }" width="100px" height="100px"> </td>
									<td >${shopCar.sprice}</td>
									<td>${shopCar.gnumber}</td>
									<td><div id="totalPrice">${shopCar.gmoney}</div></td>
									
									<td>
										<input type="hidden" name="shopCar_id" value="${shopCar.id}">
										<a class="btn btn-primary radius" href="<%=basePath%>shopCar/preUpdateShopCarHand.do?id=${shopCar.id}">修改</a>
										<a class="btn btn-primary radius" href="<%=basePath%>shopCar/deleteShopCar.do?id=${shopCar.id}&uname=<%=loginName%>">删除</a>
									</td>
						
									<td>
										<a class="btn btn-danger radius" href="<%=basePath%>orders/shopCar_details.do?id=${shopCar.id}&uname=<%=loginName%>">付款</a>
									</td>
								</tr>	
		  					</c:forEach>
						</c:if>
	    			</tbody>
				</table>
			</form>
			
			<div class="box-footer">
				<div class="box-tools pull-right">
					<ul class="pagination">
						<%--在超链接中访问js函数，必须加前缀：javascript--%>
						<li><a href="<%=basePath%>shopCar/queryAll.do?page=${page.firstPage}&uname=<%=loginName%>">首页</a></li>
						<li><a href="<%=basePath%>shopCar/queryAll.do?page=${page.prePage}&uname=<%=loginName%>">上一页</a></li>

						<li><a href="<%=basePath%>shopCar/queryAll.do?page=${page.nextPage}&uname=<%=loginName%>">下一页</a></li>
						<li><a href="<%=basePath%>shopCar/queryAll.do?page=${page.lastPage}&uname=<%=loginName%>">尾页</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				//demoIframe.attr("src",treeNode.file + ".html");
				return true;
			}
		}
	}
};		
$(document).ready(function(){
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, zNodes);
	//demoIframe = $("#testIframe");
	//demoIframe.on("load", loadReady);
	var zTree = $.fn.zTree.getZTreeObj("tree");
	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
});

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
	]
});
</script>
</body>
</html>
